<!DOCTYPE html>
<html lang=zh-CN>
<head>
<meta charset=utf-8>
<title>Linux邮件服务器安装与配置 | Cweili Beta</title>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name=description content="Linux 邮件服务器配置
MailScanner + ClamAV + Spamassassin">
<meta property=og:type content=article>
<meta property=og:title content=Linux邮件服务器安装与配置>
<meta property=og:url content="http://cweili.gitcafe.com/linux-mail-server-installation-configuration/">
<meta property=og:site_name content="Cweili Beta">
<meta property=og:description content="Linux 邮件服务器配置
MailScanner + ClamAV + Spamassassin">
<meta name=twitter:card content=summary>
<meta name=twitter:title content=Linux邮件服务器安装与配置>
<meta name=twitter:description content="Linux 邮件服务器配置
MailScanner + ClamAV + Spamassassin">
<link rel=alternative href=/atom.xml title="Cweili Beta" type=application/atom+xml>
<link rel=icon href=favicon.png>
<link rel=stylesheet href=//libs.baidu.com/bootstrap/3.2.0/css/bootstrap.min.css type=text/css>
<link rel=stylesheet href=../css/style.css type=text/css>
<!--[if lt IE 9]><script src="//cdn.staticfile.org/html5shiv/3.7/html5shiv.min.js" type="text/javascript"></script><![endif]-->
</head>
<body>
<div id=container>
<nav id=mobile-nav class=visible-xs>
<a href="/" class=mobile-nav-link>首页</a>
<ul class=category-list><li class=category-list-item><a class=category-list-link href=../category/学习笔记>学习笔记</a><span class=category-list-count>40</span></li><li class=category-list-item><a class=category-list-link href=../category/小生活>小生活</a><span class=category-list-count>27</span></li><li class=category-list-item><a class=category-list-link href=../category/杂物>杂物</a><span class=category-list-count>9</span></li></ul>
<a href="/tag/%E7%9B%B8%E5%86%8C/" class=mobile-nav-link>相册</a>
<a href="/about/" class=mobile-nav-link>关于</a>
<div class=clearfix></div>
</nav>
<div id=wrap>
<!--[if lt IE 9]><p class="browsehappy alert alert-danger">您正在使用一个<strong>过时</strong>的浏览器。请<a href="http://browsehappy.com/" target="_blank">更新您的浏览器</a>来达到更好的体验。</p><![endif]-->
<header id=header>
<div id=banner></div>
<div id=header-outer class=outer>
<div id=header-inner class=inner>
<nav class=main-nav>
<div id=main-nav-toggle class="nav-icon visible-xs"><i class="fa fa-bars"></i></div>
<a class="main-nav-link hidden-xs" href="/">首页</a>
</nav>
<nav id=category-nav class=hidden-xs>
<ul class=category-list><li class=category-list-item><a class=category-list-link href=../category/学习笔记>学习笔记</a><span class=category-list-count>40</span></li><li class=category-list-item><a class=category-list-link href=../category/小生活>小生活</a><span class=category-list-count>27</span></li><li class=category-list-item><a class=category-list-link href=../category/杂物>杂物</a><span class=category-list-count>9</span></li></ul>
</nav>
<nav class="main-nav hidden-xs">
<a class=main-nav-link href="/tag/%E7%9B%B8%E5%86%8C/">相册</a>
<a class=main-nav-link href="/about/">关于</a>
</nav>
<nav id=sub-nav>
<a id=nav-rss-link class="nav-icon pull-right hidden-xs" href=/atom.xml title="RSS 订阅"><i class="fa fa-rss"></i></a>
<div id=nav-search-btn class="nav-icon pull-right" title=搜索><i class="fa fa-search"></i></div>
</nav>
<div id=search-form-wrap>
<form action=http://www.baidu.com/baidu accept-charset=utf-8 class=search-form target=_blank>
<input type=search name=word class=search-form-input placeholder=搜索>
<input id=search-form-submit type=submit value=&nbsp; class=search-form-submit>
<input name=tn type=hidden value=bds>
<input name=cl type=hidden value=3>
<input name=ct type=hidden value=2097152>
<input type=hidden name=si value=cweili.gitcafe.com>
<label class=search-form-submit for=search-form-submit><i class="fa fa-search"></i></label>
</form>
</div>
</div>
<div id=header-title class=inner>
<h1 id=logo-wrap>
<a href="/" id=logo>Cweili Beta</a>
</h1>
<h2 id=subtitle-wrap>
<a href="/" id=subtitle>I&#39;m working on it</a>
</h2>
</div>
</div>
</header>
<div class=outer>
<section id=main class=col-sm-9><article id=post-linux-mail-server-installation-configuration class="article article-type-post" itemscope itemprop=blogPost>
<div class=article-meta>
<a href="/linux-mail-server-installation-configuration/" class=article-date>
<time datetime=2011-11-26T05:13:44.000Z itemprop=datePublished>2011-11-26</time>
</a>
<div class=article-category>
<a class=article-category-link href=../category/学习笔记>学习笔记</a>
</div>
</div>
<div class="article-inner jiathis_streak">
<header class=article-header>
<h2 class=article-title itemprop=name>
Linux邮件服务器安装与配置
</h2>
</header>
<div class=article-entry itemprop=articleBody>
<p>Linux 邮件服务器配置 </p>
<p>MailScanner + ClamAV + Spamassassin<a id=more></a></p>
<p> 一、 sendmail 安装与配置………………………………………………………………………… 1</p>
<p> 二、 clamav 的安装………………………………………………………………………………… 1</p>
<p> 三、 SpamAssassin 的安装与配置………………………………………………………………. 3</p>
<p> 四、 MailScanner 的安装………………………………………………………………………….. 6</p>
<p>1. 安装 perl 组件…………………………………………………………………………… 6</p>
<p>2. 安装 mailscanner……………………………………………………………………….. 8</p>
<p>3. 安装 clamav 及 spamassassin 支持模块…………………………………………… 8</p>
<p>4. mailscanner.conf 注解…………………………………………………………………. 8</p>
<p> 五、 MailScanner-mrtg…………………………………………………………………………….. 8</p>
<p> 六、 附录……………………………………………………………………………………………. 10</p>
<p>1. 我的 mailscanner.conf 配置………………………………………………………… 10</p>
<p>2. mailscanner.conf 配置说明…………………………………………………………. 17</p>
<p> 注：本文以 redhat8.0 为例 </p>
<h2 id="一、_sendmail 安装与配置"> 一、 sendmail 安装与配置 </h2>
<p>sendmail 安装较简单，这里不再赘述。</p>
<h2 id="二、_clamav 的安装"> 二、 clamav 的安装 </h2>
<p>`useradd -M clamav</p>
<h1 id=groupadd_clamav>groupadd clamav</h1>
<h1 id=useradd_-g_clamav_-s_/bin/false_-c_“Clam_AntiVirus”_clamav>useradd -g clamav -s /bin/false -c “Clam AntiVirus” clamav</h1>
<p>tar -zxvf clamav-0.88.2.tar.gz</p>
<h1 id=cd_clamav-0-88-2>cd clamav-0.88.2</h1>
<h1 id="-/configure_—sysconfdir=/etc">./configure —sysconfdir=/etc</h1>
<h1 id=make>make</h1>
<h1 id=su_-c_“make_install”>su -c “make install”</h1>
<h1 id="vi_/etc/clamd-conf_( 在_Example_前面加_#)">vi /etc/clamd.conf (在 Example 前面加 #)</h1>
<h1 id="vi_/etc/freshclam-conf_( 在_Example_前面加_#)`">vi /etc/freshclam.conf (在 Example 前面加 #)`</h1>
<p> 安裝後, 修改以下檔案:</p>
<p>/usr/local/etc/clamd.conf<br>/usr/local/freshclam.conf</p>
<p> 將 Example 加上井字號註解掉 → #Example</p>
<p> 執行 /usr/local/freshclam 測試是否能正常更新病毒定义码 </p>
<p>crontab –e 编辑更新计划：如每 30 分钟进行更新 </p>
<p><em>/30 </em> <em> </em> * /usr/local/bin/freshclam –quiet</p>
<p>Clamav (/usr/local/etc/clamd.conf)</p>
<p> 配置文件解释：</p>
<p>`# This option enables scanning of Microsoft Office document macros.</p>
<h1 id=Default:_enabled>Default: enabled</h1>
<p>ScanOLE2 打开 office 文档扫描 </p>
<h1 id=Enable_internal_e-mail_scanner->Enable internal e-mail scanner.</h1>
<h1 id=Default:_enabled-1>Default: enabled</h1>
<p>ScanMail 打开邮件扫描 </p>
<h1 id=ClamAV_can_scan_within_archives_and_compressed_files->ClamAV can scan within archives and compressed files.</h1>
<h1 id=Default:_enabled-1>Default: enabled</h1>
<p>ScanArchive 扫描压缩包 </p>
<h1 id=Due_to_license_issues_libclamav_does_not_support_RAR_3-0_archives_(only_the>Due to license issues libclamav does not support RAR 3.0 archives (only the</h1>
<h1 id=old_2-0_format_is_supported)-_Because_some_users_report_stability_problems>old 2.0 format is supported). Because some users report stability problems</h1>
<h1 id=with_unrarlib_it’s_disabled_by_default_and_you_must_uncomment_the_directive>with unrarlib it’s disabled by default and you must uncomment the directive</h1>
<h1 id=below_to_enable_RAR_2-0_support->below to enable RAR 2.0 support.</h1>
<h1 id=Default:_disabled>Default: disabled</h1>
<p>ScanRAR 扫描 RAR 压缩包 </p>
<h1 id=Files_in_archives_larger_than_this_limit_won’t_be_scanned->Files in archives larger than this limit won’t be scanned.</h1>
<h1 id=Value_of_0_disables_the_limit->Value of 0 disables the limit.</h1>
<h1 id=Default:_10M>Default: 10M</h1>
<p>ArchiveMaxFileSize 10M 最大扫描压缩包文件为 10 兆 </p>
<h1 id=Nested_archives_are_scanned_recursively,_e-g-_if_a_Zip_archive_contains_a_RAR>Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR</h1>
<h1 id=file,_all_files_within_it_will_also_be_scanned-_This_options_specifies_how>file, all files within it will also be scanned. This options specifies how</h1>
<h1 id=deep_the_process_should_be_continued->deep the process should be continued.</h1>
<h1 id=Value_of_0_disables_the_limit--1>Value of 0 disables the limit.</h1>
<h1 id=Default:_8>Default: 8</h1>
<p>ArchiveMaxRecursion 9 扫描压缩包 9 层 </p>
<h1 id=Number_of_files_to_be_scanned_within_an_archive->Number of files to be scanned within an archive.</h1>
<h1 id=Value_of_0_disables_the_limit--1>Value of 0 disables the limit.</h1>
<h1 id=Default:_1000>Default: 1000</h1>
<p>ArchiveMaxFiles 1000 最多扫描压缩包内 1500 个文件 </p>
<h1 id=Set_access_mask_for_Clamuko->Set access mask for Clamuko.</h1>
<h1 id=Default:_disabled-1>Default: disabled</h1>
<p>ClamukoScanOnOpen<br>ClamukoScanOnClose<br>ClamukoScanOnExec</p>
<h1 id=Don’t_scan_files_larger_than_ClamukoMaxFileSize>Don’t scan files larger than ClamukoMaxFileSize</h1>
<h1 id=Value_of_0_disables_the_limit--1>Value of 0 disables the limit.</h1>
<h1 id=Default:_5M>Default: 5M</h1>
<p>ClamukoMaxFileSize 10M`</p>
<h2 id="三、_SpamAssassin 的安装与配置"> 三、 SpamAssassin 的安装与配置 </h2>
<p> 下载最新版本：</p>
<p><a href=http://apache.justdn.org/spamassassin/source/Mail-SpamAssassin-3.1.3.tar.bz2 target=_blank rel=external>http://apache.justdn.org/spamassassin/source/Mail-SpamAssassin-3.1.3.tar.bz2</a></p>
<p><code>rpmbuild -tb Mail-SpamAssassin-3.1.3.tar.bz2</code></p>
<p> 安装生成的 2 个文件：</p>
<p><code>rpm –ivh perl-Mail-SpamAssassin-3.1.3-1.i386.rpm
rpm –ivh spamassassin-3.1.3-1.i386.rpm</code></p>
<p>Spamassassin (/etc/mail/spamassassin/local.cf) 文件注释：</p>
<p>`# SpamAssassin config file for version 3.x</p>
<h1 id=NOTE:_NOT_COMPATIBLE_WITH_VERSIONS_2-5_or_2-6>NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6</h1>
<h1 id=See>See</h1>
<p><a href=http://www.yrex.com/spam/spamconfig25.php target=_blank rel=external>http://www.yrex.com/spam/spamconfig25.php</a><br>for earlier versions</p>
<h1 id=Generated_by>Generated by</h1>
<p><a href=http://www.yrex.com/spam/spamconfig.php target=_blank rel=external>http://www.yrex.com/spam/spamconfig.php</a><br>(version 1.50)</p>
<h1 id=How_many_hits_before_a_message_is_considered_spam-_得分多少以上就会被判定为垃圾邮件。>How many hits before a message is considered spam. 得分多少以上就会被判定为垃圾邮件。</h1>
<p>required_hits 6.3</p>
<h1 id="Whether_to_change_the_subject_of_suspected_spam-_在已判定的垃圾邮件之标题加上标记。（_如果是使用 amaivsd 来呼叫 spamassass 进行过滤的，请修改_Amavisd-new_的配置文件 amavisd-conf_中的相应选项：$sa_spam_subject_tag_=_‘[_Junk_Mail_]_‘;_）">Whether to change the subject of suspected spam. 在已判定的垃圾邮件之标题加上标记。（ 如果是使用 amaivsd 来呼叫 spamassass 进行过滤的，请修改 Amavisd-new 的配置文件 amavisd.conf 中的相应选项：$sa_spam_subject_tag = ‘<strong><em>[Junk Mail]</em></strong> ‘; ）</h1>
<p>rewrite<em>header Subject <em>**</em>SPAM(_SCORE</em>)<em>**</em></p>
<h1 id=Encapsulate_spam_in_an_attachment->Encapsulate spam in an attachment.</h1>
<h1 id=要如何处理垃圾邮件。如果邮件还会经过防毒程序的扫描处理，所以必须设定为_0。> 要如何处理垃圾邮件。如果邮件还会经过防毒程序的扫描处理，所以必须设定为 0。</h1>
<h1 id=0：将信息写入邮件表头。>0：将信息写入邮件表头。</h1>
<h1 id=1：将垃圾邮件转为附件。>1：将垃圾邮件转为附件。</h1>
<h1 id=2：将垃圾邮件转为纯文字附件。>2：将垃圾邮件转为纯文字附件。</h1>
<p>report_safe 0</p>
<h1 id=Use_terse_version_of_the_spam_report-_用精简的方式来回复垃圾邮件信息给管理者>Use terse version of the spam report. 用精简的方式来回复垃圾邮件信息给管理者 </h1>
<p>use_terse_report 0</p>
<h1 id=Enable_the_Bayes_system-_使用贝叶斯学习系统>Enable the Bayes system. 使用贝叶斯学习系统 </h1>
<p>use_bayes 1</p>
<h1 id=Enable_Bayes_auto-learning-_开启贝叶斯自动学习功能>Enable Bayes auto-learning. 开启贝叶斯自动学习功能 </h1>
<p>auto_learn 1</p>
<h1 id=Enable_or_Disable_network_checks-_略过_RBLs_检查、使用_Razor_version_2、使用_DCC_(Distributed_Checksum_Clearinghouse)、使用_Pyzor>Enable or Disable network checks. 略过 RBLs 检查、使用 Razor version 2、使用 DCC (Distributed Checksum Clearinghouse)、使用 Pyzor</h1>
<p>skip_rbl_checks 0<br>use_razor2 1<br>use_dcc 1<br>use_pyzor 1</p>
<h1 id=Blacklist-_黑名单，判定減_＋_100_分>Blacklist. 黑名单，判定減 ＋ 100 分 </h1>
<p>blacklist_from <em>@sohu.com </em>@mailfb.com</p>
<h1 id=Whitelist_-_白名单，判定加_—_100_分>Whitelist . 白名单，判定加 — 100 分 </h1>
<p>whitelist_from <em>@yahoo.com.tw </em>@yahoo.com.hk *@yahoogroups.com.hk<br>whitelist_from<br>[email=rika@rika.idv.tw]rika@rika.idv.tw[/email]</p>
<h1 id=Mail_using_languages_used_in_these_country_codes_will_not_be_marked>Mail using languages used in these country codes will not be marked</h1>
<h1 id=as_being_possibly_spam_in_a_foreign_language->as being possibly spam in a foreign language.</h1>
<h1 id=-_chinese>- chinese</h1>
<p>ok_languages zh en</p>
<h1 id=Mail_using_locales_used_in_these_country_codes_will_not_be_marked>Mail using locales used in these country codes will not be marked</h1>
<h1 id=as_being_possibly_spam_in_a_foreign_language--1>as being possibly spam in a foreign language.</h1>
<p>ok_locales zh en</p>
<h1 id=Disabled_scores-_防止中文主旨和中文收件者误判，建议再加上下列几行>Disabled scores. 防止中文主旨和中文收件者误判，建议再加上下列几行 </h1>
<p>score HEADER_8BITS 0<br>score HTML_COMMENT_8BITS 0<br>score SUBJ_FULL_OF_8BITS 0<br>score UPPERCASE_25_50 0<br>score UPPERCASE_50_75 0<br>score UPPERCASE_75_100 0</p>
<h1 id=local_domain_from_but_ip_not_match-_域名和_IP_不符合，疑为垃圾邮件>local domain from but ip not match. 域名和 IP 不符合，疑为垃圾邮件 </h1>
<p>header <strong>FROM_TEATIME Received =~ /from test.com.cn/i<br>header </strong>FROM_TEATIME_IP Received =~ /[12.34.56.78]/<br>meta FROM_TEATIME_BUT_IP_ERROR (__FROM_TEATIME)<br>describe FROM_TEATIME_BUT_IP_ERROR From test.com.cn but ip not match<br>score FROM_TEATIME_BUT_IP_ERROR 8<br>score NO_REAL_NAME 4.000<br>score SPF_FAIL 10.000<br>score SPF_HELO_FAIL 10.000<br>score BAYES_99 4.300<br>score BAYES_90 3.500<br>score BAYES_80 3.000`</p>
<p> 测试 local.cf 语法 </p>
<p><code>spamassassin --lint</code></p>
<p> 测试邮件：</p>
<p><code>spamassassin -t 3.1.3/sample-spam.txt</code></p>
<p> 查看邮件日志：tail –n200 /var/log/maillog 会有如下信息：</p>
<p><code>Jun 28 19:33:36 mail MailScanner[3055]: Message k5SBXIHn016676 from 72.227.69.15 (figueroaappeasable@australiamail.com) to kecc.cn is spam, SpamAssassin (not cached, score=18.56, required 8, HTML_IMAGE_ONLY_16 0.63, HTML_MESSAGE 0.00, HTML_SHORT_LINK_IMG_2 0.95, MIME_HTML_ONLY 0.00, SPF_SOFTFAIL 1.47, URIBL_AB_SURBL 3.31, URIBL_JP_SURBL 3.36, URIBL_OB_SURBL 2.62, URIBL_SBL 1.09, URIBL_SC_SURBL 3.60, URIBL_WS_SURBL 1.53)</code></p>
<p> 收到的邮件头会有如下信息：</p>
<p><code>X-szdt-mailsystem-Information: Please contact CMEL MIS for more information
X-szdt-mailsystem: Found to be clean
X-szdt-mailsystem-SpamCheck: not spam, SpamAssassin (not cached, score=6.882,
required 8, DATE_IN_FUTURE_12_24 2.32, RATWARE_EGROUPS 2.49,
SPF_HELO_SOFTFAIL 2.08, UNPARSEABLE_RELAY 0.00)
X-szdtL-mailsystem-SpamScore: ssssss
X-szdt-MailScanner-From: zebelnkrr@intercable.net
X-Spam-Status: No
Return-Path: zebelnkrr@intercable.net
X-OriginalArrivalTime: 28 Jun 2006 09:54:01.0232 (UTC) FILETIME=[C8452900:01C69A98]</code></p>
<h2 id="四、_MailScanner 的安装"> 四、 MailScanner 的安装 </h2>
<h3 id="1-_安装 perl 组件">1. 安装 perl 组件 </h3>
<p> 需要安装如下 perl 组件：</p>
<p>perl -MCPAN -e shell 然后输入 no 让系统自动配置 </p>
<p>cpan&gt;install Digest::SHA1</p>
<p>cpan&gt;install HTML::Parser</p>
<p>cpan&gt;install Net::DNS</p>
<p>cpan&gt;install Mail::SPF::Query</p>
<p>cpan&gt;install IP::Country</p>
<p>cpan&gt;install Net::Ident</p>
<p>cpan&gt;install IO::Socket::INET6</p>
<p>cpan&gt;install IO::Socket::SSL</p>
<p>cpan&gt;install DBI</p>
<p>cpan&gt;install LWP::UserAgent</p>
<p>cpan&gt;install Mail::SpamAssassin</p>
<p>……………</p>
<p> 技巧：在安装光盘中：安装 perl-* 很多文件即可 </p>
<p>mod_perl-1.99_05-3.i386.rpm</p>
<p>pcre-devel-3.9-5.i386.rpm</p>
<p>perl-Archive-Tar-0.22-26.noarch.rpm</p>
<p>perl-BSD-Resource-1.15-4.i386.rpm</p>
<p>perl-Bit-Vector-6.1-28.i386.rpm</p>
<p>perl-CGI-2.81-55.i386.rpm</p>
<p>perl-Compress-Zlib-1.16-8.i386.rpm</p>
<p>perl-Crypt-SSLeay-0.45-2.i386.rpm</p>
<p>perl-DBD-Pg-1.13-5.i386.rpm</p>
<p>perl-DBD-SQLite-1.12-1.rh9.rf.i386.rpm</p>
<p>perl-DBI-1.30-1.i386.rpm</p>
<p>perl-DB_File-1.804-55.i386.rpm</p>
<p>perl-Date-Calc-5.0-25.i386.rpm</p>
<p>perl-Devel-Symdump-2.03-9.i386.rpm</p>
<p>perl-Digest-HMAC-1.01-8.noarch.rpm</p>
<p>perl-Digest-SHA1-2.01-6.i386.rpm</p>
<p>perl-File-MMagic-1.15-2.noarch.rpm</p>
<p>perl-Filter-Simple-0.78-8.noarch.rpm</p>
<p>perl-Frontier-RPC-0.06-33.noarch.rpm</p>
<p>perl-Inline-0.43-7.i386.rpm</p>
<p>perl-NKF-1.71-7.i386.rpm</p>
<p>perl-Net-DNS-0.26-2.noarch.rpm</p>
<p>perl-PDL-2.3.2-10.i386.rpm</p>
<p>perl-Parse-RecDescent-1.80-8.noarch.rpm</p>
<p>perl-RPM2-0.45-1.i386.rpm</p>
<p>perl-TermReadKey-2.20-2.i386.rpm</p>
<p>perl-Text-Kakasi-1.05-2.i386.rpm</p>
<p>perl-Time-HiRes-1.20-23.i386.rpm</p>
<p>perl-TimeDate-1.1301-2.noarch.rpm</p>
<p>perl-suidperl-5.8.0-55.i386.rpm</p>
<h3 id="2-_安装 mailscanner">2. 安装 mailscanner</h3>
<p> 从如下网站下载最新版本：</p>
<p><a href=http://www.mailscanner.info/files/4/rpm/MailScanner-4.54.6-1.rpm.tar.gz target=_blank rel=external>http://www.mailscanner.info/files/4/rpm/MailScanner-4.54.6-1.rpm.tar.gz</a></p>
<p><code>tai zxvvf MailScanner-4.54.6-1.rpm.tar.gz</code></p>
<p>./install.sh 即可（要安装内核源程序及 gcc）</p>
<h3 id="3-_安装 clamav 及 spamassassin 支持模块">3. 安装 clamav 及 spamassassin 支持模块 </h3>
<p><a href=http://www.mailscanner.info/files/4/install-Clam-SA.tar.gz target=_blank rel=external>http://www.mailscanner.info/files/4/install-Clam-SA.tar.gz</a></p>
<p> 然后安装即可 </p>
<h3 id="4-_mailscanner-conf 注解">4. mailscanner.conf 注解 </h3>
<p> 见附录 </p>
<h2 id=五、_MailScanner-mrtg> 五、 MailScanner-mrtg</h2>
<p> 確定是否安裝 mrtg:</p>
<p><code>rpm -qa | grep mrtg
rpm -ivh mrtg-2.10.5-3.i386.rpm</code></p>
<p> 下載 MailScanner-mrtg</p>
<p><a href=http://unc.dl.sourceforge.net/sourceforge/mailscannermrtg/mailscanner-mrtg-0.08.01-1.noarch.rpm target=_blank rel=external>http://unc.dl.sourceforge.net/sourceforge/mailscannermrtg/mailscanner-mrtg-0.08.01-1.noarch.rpm</a></p>
<p><a href="http://sourceforge.net/projects/mailscannermrtg/" target=_blank rel=external>http://sourceforge.net/projects/mailscannermrtg/</a></p>
<p><code>rpm -ivh mailscanner-mrtg-0.08.01-1.noarch.rpm</code></p>
<p> 建立一個檔案夾：</p>
<p><code>mkdir /var/spool/mailscanner-mrtg</code></p>
<p> 修改 fstab</p>
<p><code>vi /etc/fstab</code></p>
<p> 增加以下兩行（記憶體要夠多！）</p>
<p><code>none /var/spool/MailScanner/incoming tmpfs defaults 0 0
none /var/spool/mailscanner-mrtg tmpfs defaults 0 0</code></p>
<p> 加入第一行，順便連 MailScanner 的處理速度都加快了！</p>
<p>（這是 MailScanner 官方文件建議的做法，不是我自己掰的喔～）</p>
<p> 接著修改及確認 /etc/MailScanner/mailscanner-mrtg.conf</p>
<p><code>MailScanner Work Directory = /var/spool/MailScanner/incoming
...
Spool Directory = /var/spool/mailscanner-mrtg
...
Quarantine Directory = /var/spool/MailScanner/quarantine
...
Use SNMP = no</code></p>
<p>snmp 留給熟悉 snmp 的人去踹～</p>
<p> 以後你就可以在網址列輸入：</p>
<p><a href="http://your.host.ip/mailscanner-mrtg/" target=_blank rel=external>http://your.host.ip/mailscanner-mrtg/</a></p>
<p> 觀看你的郵件流量。</p>
<h2 id=六、_附录> 六、 附录 </h2>
<p>1. 我的 mailscanner.conf 配置 </p>
<p>&nbsp;</p>
<p><code>%org-name% = szdt
%org-long-name% = szdt
%web-site% = www.xxx.com
%etc-dir% = /etc/MailScanner
%report-dir% = /etc/MailScanner/reports/en
%rules-dir% = /etc/MailScanner/rules
%mcp-dir% = /etc/MailScanner/mcp
Max Children = 5
Run As User =
Run As Group =
Queue Scan Interval = 6
Incoming Queue Dir = /var/spool/mqueue.in
Outgoing Queue Dir = /var/spool/mqueue
Incoming Work Dir = /var/spool/MailScanner/incoming
Quarantine Dir = /var/spool/MailScanner/quarantine
PID file = /var/run/MailScanner.pid
Restart Every = 14400
MTA = sendmail
Sendmail = /usr/sbin/sendmail
Sendmail2 = /usr/sbin/sendmail
Incoming Work User =
Incoming Work Group =
Incoming Work Permissions = 0600
Quarantine User =
Quarantine Group =
Quarantine Permissions = 0600
Max Unscanned Bytes Per Scan = 100m
Max Unsafe Bytes Per Scan = 50m
Max Unscanned Messages Per Scan = 30
Max Unsafe Messages Per Scan = 30
Max Normal Queue Size = 800
Scan Messages = yes
Reject Message = no
Maximum Attachments Per Message = 200
Expand TNEF = yes
Use TNEF Contents = replace
Deliver Unparsable TNEF = no
TNEF Expander = /usr/bin/tnef --maxsize=100000000
TNEF Timeout = 120
File Command = /usr/bin/file
File Timeout = 20
Gunzip Command = /bin/gunzip
Gunzip Timeout = 50
Unrar Command = /usr/bin/unrar
Unrar Timeout = 50
Find UU-Encoded Files = no
Maximum Message Size = %rules-dir%/max.message.size.rules
Maximum Attachment Size = -1
Minimum Attachment Size = -1
Maximum Archive Depth = 2
Find Archives By Content = yes
Virus Scanning = yes
Virus Scanners = clamav
Virus Scanner Timeout = 300
Deliver Disinfected Files = no
Silent Viruses = HTML-IFrame All-Viruses
Still Deliver Silent Viruses = no
Non-Forging Viruses = Joke/ OF97/ WM97/ W97M/ eicar
Block Encrypted Messages = no
Block Unencrypted Messages = no
Allow Password-Protected Archives = no
Allowed Sophos Error Messages =
Monitors For Sophos Updates = /usr/local/Sophos/ide/*ides.zip
Monitors for ClamAV Updates = /usr/local/share/clamav/*.cvd
ClamAVmodule Maximum Recursion Level = 8
ClamAVmodule Maximum Files = 1000
ClamAVmodule Maximum Compression Ratio = 250
Dangerous Content Scanning = yes
Allow Partial Messages = no
Allow External Message Bodies = no
Find Phishing Fraud = yes
Also Find Numeric Phishing = yes
Use Stricter Phishing Net = yes
Highlight Phishing Fraud = yes
Phishing Safe Sites File = %etc-dir%/phishing.safe.sites.conf
Country Sub-Domains List = %etc-dir%/country.domains.conf
Allow IFrame Tags = disarm
Allow Form Tags = disarm
Allow Script Tags = disarm
Allow WebBugs = disarm
Ignored Web Bug Filenames =
Allow Object Codebase Tags = disarm
Convert Dangerous HTML To Text = no
Convert HTML To Text = no
Allow Filenames =
Deny Filenames =
Filename Rules = %etc-dir%/filename.rules.conf
Allow Filetypes =
Deny Filetypes =
Filetype Rules = %etc-dir%/filetype.rules.conf
Quarantine Infections = yes
Quarantine Silent Viruses = no
Quarantine Modified Body = no
Quarantine Whole Message = no
Quarantine Whole Messages As Queue Files = no
Keep Spam And MCP Archive Clean = no
Language Strings = %report-dir%/languages.conf
Rejection Report = %report-dir%/rejection.report.txt
Deleted Bad Content Message Report = %report-dir%/deleted.content.message.txt
Deleted Bad Filename Message Report = %report-dir%/deleted.filename.message.txt
Deleted Virus Message Report = %report-dir%/deleted.virus.message.txt
Stored Bad Content Message Report = %report-dir%/stored.content.message.txt
Stored Bad Filename Message Report = %report-dir%/stored.filename.message.txt
Stored Virus Message Report = %report-dir%/stored.virus.message.txt
Disinfected Report = %report-dir%/disinfected.report.txt
Inline HTML Signature = %report-dir%/inline.sig.html
Inline Text Signature = %report-dir%/inline.sig.txt
Inline HTML Warning = %report-dir%/inline.warning.html
Inline Text Warning = %report-dir%/inline.warning.txt
Sender Content Report = %report-dir%/sender.content.report.txt
Sender Error Report = %report-dir%/sender.error.report.txt
Sender Bad Filename Report = %report-dir%/sender.filename.report.txt
Sender Virus Report = %report-dir%/sender.virus.report.txt
Hide Incoming Work Dir = yes
Include Scanner Name In Reports = yes
Mail Header = X-%org-name%-mailsystem:
Spam Header = X-%org-name%-mailsystem-SpamCheck:
Spam Score Header = X-%org-name%-mailsystem-SpamScore:
Information Header = X-%org-name%-mailsystem-Information:
Add Envelope From Header = yes
Add Envelope To Header = no
Envelope To Header = X-%org-name%-MailScanner-To:
Spam Score Character = s
SpamScore Number Instead Of Stars = no
Minimum Stars If On Spam List = 0
Clean Header Value = Found to be clean
Infected Header Value = Found to be infected
Disinfected Header Value = Disinfected
Information Header Value = Please contact CMEL MIS for more information
Detailed Spam Report = yes
Include Scores In SpamAssassin Report = yes
Always Include SpamAssassin Report = yes
Multiple Headers = append
Hostname = the %org-name% ($HOSTNAME) MailScanner
Sign Messages Already Processed = no
Sign Clean Messages = yes
Mark Infected Messages = yes
Mark Unscanned Messages = yes
Unscanned Header Value = Not scanned: please contact MIS for details
Remove These Headers = X-Mozilla-Status: X-Mozilla-Status2:
Deliver Cleaned Messages = yes
Notify Senders = yes
Notify Senders Of Viruses = no
Notify Senders Of Blocked Filenames Or Filetypes = yes
Notify Senders Of Other Blocked Content = yes
Never Notify Senders Of Precedence = list bulk
Scanned Subject Text = {Scanned}
Virus Modify Subject = yes
Virus Subject Text = {Virus?}
Filename Modify Subject = yes
Filename Subject Text = {Filename?}
Content Modify Subject = yes
Content Subject Text = {Dangerous Content?}
Disarmed Subject Text = {Disarmed}
Phishing Modify Subject = no
Phishing Subject Text = {Fraud?}
Spam Modify Subject = yes
Spam Subject Text = {Spam?}
High Scoring Spam Modify Subject = yes
High Scoring Spam Subject Text = {Spam?}
Warning Is Attachment = yes
Attachment Warning Filename = %org-name%-Attachment-Warning.txt
Attachment Encoding Charset = ISO-8859-1
Archive Mail =
Archive Mail =
Send Notices = yes
Notices Include Full Headers = yes
Hide Incoming Work Dir in Notices = no
Notice Signature = -- \nMailScanner\nEmail Virus Scanner\nwww.mailscanner.info
Notices From = MailScanner
Notices To = postmaster
Local Postmaster = postmaster
Spam List Definitions = %etc-dir%/spam.lists.conf
Virus Scanner Definitions = %etc-dir%/virus.scanners.conf
Spam Checks = yes
Spam Domain List =
Spam Lists To Be Spam = 1
Spam Lists To Reach High Score = 3
Spam List Timeout = 10
Max Spam List Timeouts = 7
Spam List Timeouts History = 10
Is Definitely Not Spam = %rules-dir%/spam.whitelist.rules
Is Definitely Spam = no
Definite Spam Is High Scoring = no
Ignore Spam Whitelist If Recipients Exceed = 20
Use SpamAssassin = yes
Max SpamAssassin Size = 60k
Required SpamAssassin Score = 7
High SpamAssassin Score = 10
SpamAssassin Auto Whitelist = yes
SpamAssassin Timeout = 75
Max SpamAssassin Timeouts = 10
SpamAssassin Timeouts History = 30
Check SpamAssassin If On Spam List = yes
Spam Score = yes
Cache SpamAssassin Results = yes
SpamAssassin Cache Database File = /var/spool/MailS</code></p>
<div class=ujian-hook></div>
</div>
<footer class=article-footer>
<div class=bdsharebuttonbox>
<a href=# class=bds_tsina data-cmd=tsina title=分享到新浪微博></a>
<a href=# class=bds_qzone data-cmd=qzone title=分享到QQ空间></a>
<a href=# class=bds_tqq data-cmd=tqq title=分享到腾讯微博></a>
<a href=# class=bds_weixin data-cmd=weixin title=分享到微信></a>
<a href=# class=bds_tieba data-cmd=tieba title=分享到百度贴吧></a>
<a href=# class=bds_renren data-cmd=renren title=分享到人人网></a>
<a href=# class=bds_tqf data-cmd=tqf title=分享到腾讯朋友></a>
<a href=# class=bds_douban data-cmd=douban title=分享到豆瓣网></a>
<a href=# class=bds_tsohu data-cmd=tsohu title=分享到搜狐微博></a>
<a href=# class=bds_t163 data-cmd=t163 title=分享到网易微博></a>
<a href=# class=bds_taobao data-cmd=taobao title=分享到我的淘宝></a>
<a href=# class=bds_fx data-cmd=fx title=分享到飞信></a>
<a href=# class=bds_hi data-cmd=hi title=分享到百度空间></a>
<a href=# class=bds_more data-cmd=more></a>
</div>
<ul class=article-tag-list><li class=article-tag-list-item><a class=article-tag-list-link href=../tag/linux>Linux</a></li><li class=article-tag-list-item><a class=article-tag-list-link href=../tag/计算机>计算机</a></li><li class=article-tag-list-item><a class=article-tag-list-link href=../tag/计算机网络>计算机网络</a></li></ul>
</footer>
</div>
<nav id=article-nav>
<a href="/computer-system-safety-level/" id=article-nav-newer class=article-nav-link-wrap>
<strong class=article-nav-caption>Newer</strong>
<div class=article-nav-title>
计算机系统安全等级
</div>
</a>
<a href="/computer-network-assignment/" id=article-nav-older class=article-nav-link-wrap>
<strong class=article-nav-caption>Older</strong>
<div class=article-nav-title>计算机网络 课外作业</div>
</a>
</nav>
</article>
<section id=comments>
<div class=ds-thread data-thread-key="linux-mail-server-installation-configuration/" data-title=Linux邮件服务器安装与配置 data-url="http://cweili.gitcafe.com/linux-mail-server-installation-configuration/"></div>
</section>
</section>
<aside id=sidebar class=col-sm-3>
<div class="widget-wrap hidden-xs">
<h3 class=widget-title>分类</h3>
<div class=widget>
<ul class=category-list><li class=category-list-item><a class=category-list-link href=../category/学习笔记>学习笔记</a><span class=category-list-count>40</span></li><li class=category-list-item><a class=category-list-link href=../category/小生活>小生活</a><span class=category-list-count>27</span></li><li class=category-list-item><a class=category-list-link href=../category/杂物>杂物</a><span class=category-list-count>9</span></li></ul>
</div>
</div>
<div class=widget-wrap>
<h3 class=widget-title>最新评论</h3>
<div class=widget>
<div class=ds-recent-comments data-num-items=10 data-show-avatars=1 data-show-time=1 data-show-title=0 data-show-admin=1 data-excerpt-length=20>
<div class=text-center><i class="fa fa-refresh fa-spin"></i></div>
</div>
</div>
</div>
<div class=widget-wrap>
<h3 class=widget-title>最新文章</h3>
<div class=widget>
<ul>
<li>
<a href="/xixishidi/">河塘飞鸟西溪湿地</a>
</li>
<li>
<a href="/xizihu/">水光潋滟西子湖畔</a>
</li>
<li>
<a href="/xitang/">柳絮纷飞烟雨西塘</a>
</li>
<li>
<a href="/wuzhen/">灯火阑珊水映乌镇</a>
</li>
<li>
<a href="/stu3-zoo/">Stu3 Zoo</a>
</li>
<li>
<a href="/jshint-options/">JSHint配置参数详解</a>
</li>
<li>
<a href="/css3-jquery-rocket-to-top/">CSS3动画与jQuery实现返回顶部小火箭</a>
</li>
<li>
<a href="/rebuild-blog-gitcafe/">再一次重建我的博客</a>
</li>
<li>
<a href="/java-poi-excel/">Java使用POI创建Excel图表</a>
</li>
<li>
<a href="/hibernate-connect-sqlite-paging-bug-repair/">Hibernate 连接 SQLite (hibernate-sqlite) 分页bug的修复</a>
</li>
<li>
<a href="/web-page-color-chart/">更全的网页颜色表</a>
</li>
<li>
<a href="/quarrying-rocky-4/">20120407春游采石矶(四)</a>
</li>
<li>
<a href="/quarrying-rocky-3/">20120407春游采石矶(三)</a>
</li>
<li>
<a href="/quarrying-rocky-2/">20120407春游采石矶(二)</a>
</li>
<li>
<a href="/quarrying-rocky/">20120407春游采石矶(一)</a>
</li>
<li>
<a href="/ahpu-spring/">安徽工程大学的春天</a>
</li>
<li>
<a href="/helps-students-assembled-computer/">帮同学组装帅气小机箱电脑一台</a>
</li>
<li>
<a href="/nanjing-trip-4/">20120310南京二日行(四)</a>
</li>
<li>
<a href="/nanjing-trip-3/">20120310南京二日行(三)</a>
</li>
<li>
<a href="/nanjing-trip-2/">20120310南京二日行(二)</a>
</li>
</ul>
</div>
</div>
<div class="widget-wrap hidden-xs">
<h3 class=widget-title>手机阅读</h3>
<div class=widget>
<div class=qrcode style="background-image:url(http://qr.liantu.com/api.php?bg=eeeeee&fg=000000&el=l&w=192&m=0&text=http://cweili.gitcafe.com/linux-mail-server-installation-configuration/)"></div>
</div>
</div>
<div class="widget-wrap hidden-xs">
<h3 class=widget-title>标签云</h3>
<div class="widget tagcloud">
<a href=../tag/acm style=font-size:10px>ACM</a><a href=../tag/c++ style=font-size:15.71px>C++</a><a href=../tag/css style=font-size:10px>CSS</a><a href=../tag/fedora style=font-size:15.71px>Fedora</a><a href=../tag/gnome style=font-size:11.43px>Gnome</a><a href=../tag/hibernate style=font-size:10px>Hibernate</a><a href=../tag/jshint style=font-size:10px>JSHint</a><a href=../tag/java style=font-size:11.43px>Java</a><a href=../tag/javascript style=font-size:12.86px>JavaScript</a><a href=../tag/linux style=font-size:17.14px>Linux</a><a href=../tag/pdo style=font-size:10px>PDO</a><a href=../tag/php style=font-size:12.86px>PHP</a><a href=../tag/poi style=font-size:10px>POI</a><a href=../tag/photoshop style=font-size:14.29px>Photoshop</a><a href=../tag/sae style=font-size:10px>SAE</a><a href=../tag/sql style=font-size:14.29px>SQL</a><a href=../tag/sqlite style=font-size:11.43px>SQLite</a><a href=../tag/stl style=font-size:11.43px>STL</a><a href=../tag/stu3 style=font-size:10px>Stu3</a><a href=../tag/twitter style=font-size:10px>Twitter</a><a href=../tag/virtualbox style=font-size:10px>VirtualBox</a><a href=../tag/jquery style=font-size:10px>jQuery</a><a href=../tag/三国杀 style=font-size:15.71px>三国杀</a><a href=../tag/乌镇 style=font-size:10px>乌镇</a><a href=../tag/互联网 style=font-size:10px>互联网</a><a href=../tag/动漫 style=font-size:11.43px>动漫</a><a href=../tag/动画 style=font-size:10px>动画</a><a href=../tag/南京 style=font-size:14.29px>南京</a><a href=../tag/博客 style=font-size:14.29px>博客</a><a href=../tag/实验 style=font-size:15.71px>实验</a><a href=../tag/容器 style=font-size:11.43px>容器</a><a href=../tag/小说 style=font-size:10px>小说</a><a href=../tag/微博 style=font-size:11.43px>微博</a><a href=../tag/心情 style=font-size:14.29px>心情</a><a href=../tag/摄影 style=font-size:17.14px>摄影</a><a href=../tag/操作系统 style=font-size:14.29px>操作系统</a><a href=../tag/数据库 style=font-size:18.57px>数据库</a><a href=../tag/旅行 style=font-size:20px>旅行</a><a href=../tag/日记 style=font-size:17.14px>日记</a><a href=../tag/杭州 style=font-size:11.43px>杭州</a>
</div>
</div>
<div class="widget-wrap hidden-xs">
<h3 class=widget-title>归档</h3>
<div class=widget>
<ul class=archive-list><li class=archive-list-item><a class=archive-list-link href=../archive/2014/09>September 2014</a><span class=archive-list-count>4</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2014/08>August 2014</a><span class=archive-list-count>4</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2012/09>September 2012</a><span class=archive-list-count>1</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2012/05>May 2012</a><span class=archive-list-count>2</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2012/04>April 2012</a><span class=archive-list-count>5</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2012/03>March 2012</a><span class=archive-list-count>5</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2011/12>December 2011</a><span class=archive-list-count>4</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2011/11>November 2011</a><span class=archive-list-count>18</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2011/10>October 2011</a><span class=archive-list-count>32</span></li><li class=archive-list-item><a class=archive-list-link href=../archive/2011/05>May 2011</a><span class=archive-list-count>2</span></li></ul>
</div>
</div>
<div class="widget-wrap hidden-xs">
<h3 class=widget-title>友情链接</h3>
<div class=widget>
<ul>
<li>
<a href=http://cweili.gitcafe.com target=_blank>主页</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id=footer>
<div class=footer-wrap>
<div class=outer>
<div class=inner>
<div id=social-network>
<a class=link href=https://github.com/Cweili target=_blank><i class="fa fa-fw fa-github"></i></a>
<a class=link href=http://weibo.com/cweili target=_blank><i class="fa fa-fw fa-weibo"></i></a>
</div>
<div id=footer-info>
&copy; 2014 <a href=http://cweili.gitcafe.com target=_blank>Cweili</a><br>
Powered by <a href="http://hexo.io/" target=_blank>Hexo</a>.
Theme by <a href=http://cweili.gitcafe.com target=_blank>Cweili</a>.
</div>
</div>
</div>
</div>
</footer>
</div>
</div>
<div id=rocket-to-top>
<div class=onhover></div>
<div class=anim></div>
</div>
<link rel=stylesheet href=//libs.baidu.com/fontawesome/4.0.3/css/font-awesome.min.css css type=text/css>
<script src=//libs.baidu.com/jquery/1.11.1/jquery.min.js type=text/javascript></script><link rel=stylesheet href=//cdn.staticfile.org/fancybox/2.1.5/jquery.fancybox.min.css type=text/css>
<script src=//cdn.staticfile.org/fancybox/2.1.5/jquery.fancybox.min.js type=text/javascript></script><script src=../js/script.js type=text/javascript></script><script type=text/javascript>var duoshuoQuery={short_name:"cweiligitcafe"};</script><script src=//static.duoshuo.com/embed.js type=text/javascript></script><script type=text/javascript>var ujian_config={num:10,showType:3};</script><script src="http://v1.ujian.cc/code/ujian.js?uid=1539214&_=.js" type=text/javascript></script><script type=text/javascript>window._bd_share_config={common:{bdSnsKey:{},bdPopTitle:"分享到",bdMini:2,bdPopupOffsetLeft:28,bdPopupOffsetTop:108,bdMiniList:["sqq","mshare","bdysc","kaixin001","ibaidu","baidu","ff","qy","meilishuo","mogujie","diandian","ty","youdao","sdo"],bdPic:"",bdStyle:1,bdSize:"24"},share:{},image:{viewList:["tsina","qzone","tqq","weixin","tieba","renren","tqf","douban","tsohu","t163","taobao","fx","hi"],viewText:" ",viewSize:"24"},selectShare:{bdContainerClass:"article",bdSelectMiniList:["tsina","qzone","tqq","weixin","tieba","renren","tqf","douban","tsohu","t163","taobao","fx","hi"]}},document.write('<script type="text/javascript" src="http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date/36e5)+'"><\/script>');</script><div id=stat-wrap>
<script src="http://s19.cnzz.com/stat.php?id=1252976445&web_id=1252976445" type=text/javascript></script></div></body></html>